import request from '@/utils/request'

const increase = (userId, productId) => {
  return request({
    url: `/carts/increase/${userId}/${productId}`,
    method: 'post',
  })
}
const decrease = (userId, productId) => {
  return request({
    url: `/carts/decrease/${userId}/${productId}`,
    method: 'post',
  })
}

const list = (userId) => {
  return request({
    url: `/carts/list/${userId}`,
    method: 'post',
  })
}

const remove = (id) => {
  return request({
    url: `/carts/delete/${id}`,
    method: 'delete',
  })
}

const select = (id) => {
  return request({
    url: `/carts/select/${id}`,
    method: 'post',
  })
}

const clear = (userId) => {
  return request({
    url: `/carts/clear/${userId}`,
    method: 'delete',
  })
}

export default {
  increase,
  decrease,
  list,
  remove,
  clear,
  select,
}
